package me.kuye.jkuye.token;

import java.io.Serializable;

public class Token implements Serializable{
	private String id;
	private long expairTime;

	public Token(String id, long expairTime) {
		if (id == null) {
			throw new IllegalArgumentException("the token id can not be null");
		}
		this.id = id;
		this.expairTime = expairTime;
	}

	public Token(String id) {
		if (id == null) {
			throw new IllegalArgumentException("the token id can not be null");
		}
		this.id = id;
	}

	public String getId() {
		return id;
	}

	public long getExpairTime() {
		return expairTime;
	}

	public int hashCode() {
		return id.hashCode();
	}

	public boolean equals(Object object) {
		if (object instanceof Token)
			return ((Token) object).id.equals(this.id);
		return false;
	}
}
